#include "Adetector.h"
void GetFinalState_detector_met(CDraw &para, AnalyseClass &analyse,AObject &object,  TClonesArray *branchMissingET, MyPlots *plots,std::vector<MissingET*> &met, bool &Jmet){
	float pt;

	para.debug.Message(4,25,"in the missingET cut function");
	MissingET *met_ptr = (MissingET*) branchMissingET->At(0);
	pt = met_ptr->MET;

	if(para.met.JCUT_pt[0] == true && (pt<para.met.CUT_ptd[0] || pt>para.met.CUT_ptu[0])){
		para.debug.Message(4,25,"false: missingET", pt);
		Jmet=false;
		return;
	}
	para.debug.Message(4,25,"fill MET plot");
	AFill_Plot(para,plots->fMissingET,pt);
	met.push_back(met_ptr);

	para.debug.Message(4,25,"fill MET into Lmet",met[0]->P4(),met.size());
	for(int i=0;i<met.size();i++){
		object.Lmet.push_back(met[i]->P4());
	}
	para.debug.Message(4,25,"sort Lmet");
	std::sort(object.Lmet.begin(),object.Lmet.end(),TLV_compare_Pt);
	Jmet=true;
	if(Jmet){
		analyse.counter.getCounter("basic_met");
	}
	return;
}



